function displayRandomValues(){
$('#ImgLoader').html('<img src="images/ajax-loader.gif"/>');
$('#serching').val('');
	$.ajax({
	type: "GET",
	url: webServiceUrl+'dictionary',
	success: function(data){
		if(data.value==1){
			var word="";
			var description="";
			var obj = eval("(" + data.dictionaryList + ")");
			$.each(obj, function (index,Object) {
				 word+=Object.word;
				 description+=Object.definition;
			});
			getImageFunction(word,description);
		}
	}
	});
}
function getImageFunction(word,descrption){
$.ajax({
	type: "POST",
	url : webServiceUrl+'dictionary',
	data: {word:word},
	success: function(data){
		$('#ImgLoader').html('');
		$('#image').html(data.image);
		$('#word').html(word);
		$('#desc').html(descrption);
	}
	});
}
function serchWord(){
var serch= $('#serching').val();
var flag=true;
	if(serch==""){
		$('#serchError').html('Required');
		$('#ImgLoader').html('<img src="images/ajax-loader.gif"/>');
		$('#wordError').html('');
		flag=false;
	}else{
		$('#image').hide();
		$('#ImgLoader').html('<img src="images/ajax-loader.gif"/>');
		$('#serchError').html('');
		$.ajax({
		type: "GET",
		url: webServiceUrl+'dictionary/'+serch,
		success: function(data)
		{ 
			$('#ImgLoader').html('');
			$('#serching').val('');
			if(data.value==1){
				var word="";
				var description="";
				var obj = eval("(" + data.worddata + ")");
				$.each(obj, function (index,Object) {
					 word+=Object.word;
					 description+=Object.definition;
				});
				$('#image').show();
				$('#image').html(data.image);
				$("#word").show();
				$("#desc").show();
				$('#word').html(word);
				$('#desc').html(description);
				$('#wordError').html('');
			}else{
				$('#ImgLoader').html('');
				$("#word").hide();
				$("#desc").hide();
				$('#wordError').html('Meaning not found');
			}
		}		
		});
	}
}
function quizFunction(){
	window.location="quizindex.html";
}
var sno;
dictionary = new Array();
function getQuizInformation(){
var randomarray = [0,1,2,3];
    for (var i = randomarray.length - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var temp = randomarray[i];
        randomarray[i] = randomarray[j];
        randomarray[j] = temp;
    }
var next="";
var previous="";
var submit="";
var quizdata1="";
var quizdata2="";
var quizdata3="";
var quizdata4="";
var quizDefinition1="";
var quizDefinition2="";
var quizDefinition3="";
var quizDefinition4="";
var hid_value=$('#hid_value').val();
var pre_hid_value=$('#pre_hid_value').val();
	if(hid_value==1){
		$('#ImgLoader').html('<img src="images/ajax-loader.gif"/>');
		dictionary[hid_value] = new Array();
		$.ajax({
			type: "PUT",
			url: webServiceUrl+'dictionary/'+'0',
			data: {type:'0'},
			success: function(data){
				if(data.value==1){
					$('#ImgLoader').html('');
					var word="";
					var description="";
					$('#previous').hide();
					var radiooption=$('#radio_option').val();
					$('#incvalue').html(hid_value+'.');
					var obj = eval("(" + data.dictionaryList + ")");
					$.each(obj, function (index,Object) {
						if(index==0){
							$('#quizword').html('WHAT IS THE MEANING OF '+Object.word);
							dictionary[hid_value][0]=Object.word;
							dictionary[hid_value][5]=Object.sno;
							dictionary[hid_value][1]="";
							dictionary[hid_value][2]="";
							dictionary[hid_value][3]="";
							dictionary[hid_value][4]="";
							dictionary[hid_value][6]=0;
							dictionary[hid_value][7]=0;
							dictionary[hid_value][8]=0;
							dictionary[hid_value][9]=0;
						}
						if(index==randomarray[0]){
							quizdata1 ='<input type="radio" name="option'+radiooption+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
							quizDefinition1 =  Object.definition;
							dictionary[hid_value][1] +=Object.definition;
							dictionary[hid_value][6] +=parseInt(Object.sno);
						}else if(index==randomarray[1]){
							quizdata2 ='<input type="radio" name="option'+radiooption+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
							quizDefinition2 =  Object.definition;
							dictionary[hid_value][2] +=Object.definition;
							dictionary[hid_value][7] +=parseInt(Object.sno);
							
						}else if(index==randomarray[2]){
							quizdata3 ='<input type="radio" name="option'+radiooption+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
							quizDefinition3 =  Object.definition;
							dictionary[hid_value][3] +=Object.definition;
							dictionary[hid_value][8] +=parseInt(Object.sno);
							
						}else{
							quizdata4 ='<input type="radio" name="option'+radiooption+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
							quizDefinition4 =  Object.definition;
							dictionary[hid_value][4] +=Object.definition;
							dictionary[hid_value][9] +=parseInt(Object.sno);
						}
					});
					localStorage["dictionary"] = JSON.stringify(dictionary);
					next ='<a href="javascript:void(0)" onclick="nextQuestion()" ><h3>Next</h3></a>';
					$('#quizdata1').html(quizdata1);
					$('#quizDefinition1').html(quizDefinition1);
					$('#quizdata2').html(quizdata2);
					$('#quizDefinition2').html(quizDefinition2);
					$('#quizdata3').html(quizdata3);
					$('#quizDefinition3').html(quizDefinition3);
					$('#quizdata4').html(quizdata4);
					$('#quizDefinition4').html(quizDefinition4);
					$('#next').html(next);
					$('#hid_value').val(parseInt(hid_value)+1);
					$('#pre_hid_value').val(parseInt($('#hid_value').val())-1);
				}
			}
		});
	}else{
		var dictionaryData= JSON.parse(localStorage["dictionary"]);
		if(dictionaryData.length>hid_value){
		var decRadio_option=parseInt($('#radio_option').val())+ 1;
			$('#incvalue').html(parseInt(decRadio_option)+1+'.');
			$('#quizword').html('WHAT IS THE MEANING OF '+dictionaryData[hid_value][0]);
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][6]){
				 quizdata1 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][6]+'" value="'+dictionaryData[hid_value][6]+'" checked="checked" />';
				quizDefinition1= dictionaryData[hid_value][1];
			}else{
				quizdata1 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][6]+'" value="'+dictionaryData[hid_value][6]+'" onclick="selectFunction('+dictionaryData[hid_value][6]+')" />';
				quizDefinition1=dictionaryData[hid_value][1];
			}
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][7]){
				 quizdata2 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][7]+'" value="'+dictionaryData[hid_value][7]+'" checked="checked" />';
				quizDefinition2 = dictionaryData[hid_value][2];
			}else{
				quizdata2 = '<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][7]+'" value="'+dictionaryData[hid_value][7]+'" onclick="selectFunction('+dictionaryData[hid_value][7]+')" />';
				quizDefinition2 = dictionaryData[hid_value][2];
			}
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][8]){
				 quizdata3 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][8]+'" value="'+dictionaryData[hid_value][8]+'" checked="checked" />';
				quizDefinition3= dictionaryData[hid_value][3];
			}else{
				quizdata3='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][8]+'" value="'+dictionaryData[hid_value][8]+'" onclick="selectFunction('+dictionaryData[hid_value][8]+')" />';
				quizDefinition3=dictionaryData[hid_value][3];
			}
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][9]){
				 quizdata4 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][9]+'" value="'+dictionaryData[hid_value][9]+'" checked="checked" />';
				 quizDefinition4=dictionaryData[hid_value][4];
			}else{
				quizdata4='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[hid_value][9]+'" value="'+dictionaryData[hid_value][9]+'" onclick="selectFunction('+dictionaryData[hid_value][9]+')" />';
				quizDefinition4=dictionaryData[hid_value][4];
			}
			$('#previous').show();
			if(hid_value==5){
				previous ='<a href="javascript:void(0)" onclick="previousQuestion()" ><h3>Previous</h3></a>';
				submit ='<a href="javascript:void(0)" onclick="submitQuestion()" ><h3>Submit</h3></a>';
				$('#previous').html(previous);
				$('#next').html(submit);
			}else{
				next ='<a href="javascript:void(0)" onclick="nextQuestion()" ><h3>Next</h3></a>';
				previous ='<a href="javascript:void(0)" onclick="previousQuestion()" ><h3>Previous</h3></a>';
				$('#next').html(next);
				$('#previous').html(previous);
			}
			$('#quizdata1').html(quizdata1);
			$('#quizDefinition1').html(quizDefinition1);
			$('#quizdata2').html(quizdata2);
			$('#quizDefinition2').html(quizDefinition2);
			$('#quizdata3').html(quizdata3);
			$('#quizDefinition3').html(quizDefinition3);
			$('#quizdata4').html(quizdata4);
			$('#quizDefinition4').html(quizDefinition4);
			$('#hid_value').val(parseInt(hid_value)+1);
			$('#pre_hid_value').val(parseInt($('#hid_value').val())-1);
			$('#radio_option').val(parseInt(decRadio_option));
		}else{
			var dictionaryData= JSON.parse(localStorage["dictionary"]);
			dictionaryData[hid_value] = new Array();
			var radio_option = parseInt($('#radio_option').val()) + 1;
			$('#ImgLoader').html('<img src="images/ajax-loader.gif"/>');
			$.ajax({
				type: "PUT",
				url: webServiceUrl+'dictionary/'+'0',
				data: {type:'0'},
				success: function(data){
					if(data.value==1){
						$('#ImgLoader').html('');
						$('#previous').show();
						$('#incvalue').html(parseInt(radio_option)+1+'.');
						var obj = eval("(" + data.dictionaryList + ")");
						$.each(obj, function (index,Object) {
							if(index==0){
								$('#quizword').html('WHAT IS THE MEANING OF '+Object.word);
								dictionaryData[hid_value][0]=Object.word;
								dictionaryData[hid_value][5]=Object.sno;
								dictionaryData[hid_value][1]="";
								dictionaryData[hid_value][2]="";
								dictionaryData[hid_value][3]="";
								dictionaryData[hid_value][4]="";
								dictionaryData[hid_value][6]=0;
								dictionaryData[hid_value][7]=0;
								dictionaryData[hid_value][8]=0;
								dictionaryData[hid_value][9]=0;
							}
							if(index==randomarray[0]){
								quizdata1 ='<input type="radio" name="option'+radio_option+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
								quizDefinition1=Object.definition;
								dictionaryData[hid_value][1]=Object.definition;
								dictionaryData[hid_value][6]=Object.sno;
							}else if(index==randomarray[1]){
								quizdata2 ='<input type="radio" name="option'+radio_option+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
								quizDefinition2=Object.definition;
								dictionaryData[hid_value][2]=Object.definition;
								dictionaryData[hid_value][7]=Object.sno;
							}else if(index==randomarray[2]){
								quizdata3 ='<input type="radio" name="option'+radio_option+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
								quizDefinition3=Object.definition;
								dictionaryData[hid_value][3]=Object.definition;
								dictionaryData[hid_value][8]=Object.sno;
							}else if(index==randomarray[3]){
								quizdata4 ='<input type="radio" name="option'+radio_option+'" id="option1'+Object.sno+'" value="'+Object.sno+'" onclick="selectFunction('+Object.sno+')">';
								quizDefinition4=Object.definition;
								dictionaryData[hid_value][4]=Object.definition;
								dictionaryData[hid_value][9]=Object.sno;
							}
						});
						localStorage["dictionary"] = JSON.stringify(dictionaryData);
						if(hid_value==5){
							previous ='<a href="javascript:void(0)" onclick="previousQuestion()" ><h3>Previous</h3></a>';
							submit ='<a href="javascript:void(0)" onclick="submitQuestion()" ><h3>Submit</h3></a>';
							$('#previous').html(previous);
							$('#next').html(submit);
						}else{
							next ='<a href="javascript:void(0)" onclick="nextQuestion()" ><h3>Next</h3></a>';
							previous ='<a href="javascript:void(0)" onclick="previousQuestion()" ><h3>Previous</h3></a>';
							$('#next').html(next);
							$('#previous').html(previous);
						}  
						$('#quizdata1').html(quizdata1);
						$('#quizDefinition1').html(quizDefinition1);
						$('#quizdata2').html(quizdata2);
						$('#quizDefinition2').html(quizDefinition2);
						$('#quizdata3').html(quizdata3);
						$('#quizDefinition3').html(quizDefinition3);
						$('#quizdata4').html(quizdata4);
						$('#quizDefinition4').html(quizDefinition4);
						$('#hid_value').val(parseInt(hid_value)+1);
						$('#pre_hid_value').val(parseInt($('#hid_value').val())-1);
						$('#radio_option').val(parseInt(radio_option));
					}
				}
			});
		}
	}
}

function nextQuestion(){
var dictionaryData= JSON.parse(localStorage["dictionary"]);
var hid_value=parseInt($('#hid_value').val())-1;
var checked_site_radio = $('input:radio[id=option1'+sno+']:checked').val();
if(typeof checked_site_radio=="undefined"){
	if(typeof dictionaryData[hid_value][10]!="undefined" ){
		if(dictionaryData[hid_value][10]==dictionaryData[hid_value][6]){
			var checked_site_radio=dictionaryData[hid_value][6];
		}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][7]){
			var checked_site_radio=dictionaryData[hid_value][7];
		}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][8]){
			var checked_site_radio=dictionaryData[hid_value][8];
		}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][9]){
			var checked_site_radio=dictionaryData[hid_value][9];
		}
	}
}
if(typeof dictionaryData[hid_value][10]!="undefined" ){
	if(typeof dictionaryData[hid_value][11]!="undefined" ){
		dictionaryData[hid_value].splice(11,1);
	}
	dictionaryData[hid_value].splice(10,1);
	dictionaryData[hid_value].push(checked_site_radio);
}else{
	dictionaryData[hid_value].push(checked_site_radio);
}
if(typeof dictionaryData[hid_value][10]!="undefined"){
	if(dictionaryData[hid_value][5]==dictionaryData[hid_value][10]){
		dictionaryData[hid_value].push("1");
	}else{
		dictionaryData[hid_value].push("0");
	}
}
localStorage["dictionary"] = JSON.stringify(dictionaryData);
getQuizInformation();
}

function previousQuestion(){
var decRadio_option=parseInt($('#radio_option').val())-1;	
var quizdata="";
var hid_value=parseInt($('#hid_value').val())-1;
var pre_hid_value=$('#pre_hid_value').val();
var decreseHidvalue=parseInt(pre_hid_value) - 1;
$('#incvalue').html(decreseHidvalue+'.');
var dictionaryData= JSON.parse(localStorage["dictionary"]);
var checked_site_radio = $('input:radio[id=option1'+sno+']:checked').val();
	if(typeof checked_site_radio=="undefined"){
		if(typeof dictionaryData[hid_value][10]!="undefined"){
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][6]){
				var checked_site_radio=dictionaryData[hid_value][6];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][7]){
				var checked_site_radio=dictionaryData[hid_value][7];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][8]){
				var checked_site_radio=dictionaryData[hid_value][8];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][9]){
				var checked_site_radio=dictionaryData[hid_value][9];
			}
		}
	}
	if(typeof dictionaryData[hid_value][10]!="undefined"){
		if(typeof dictionaryData[hid_value][11]!="undefined"){
			dictionaryData[hid_value].splice(11,1);
		}
		dictionaryData[hid_value].splice(10,1);
		dictionaryData[hid_value].push(checked_site_radio);
	}else{
		dictionaryData[hid_value].push(checked_site_radio);
	}
	if(typeof dictionaryData[hid_value][10]!="undefined"){
		if(dictionaryData[hid_value][5]==dictionaryData[hid_value][10]){
			dictionaryData[hid_value].push("1");
		}else{
			dictionaryData[hid_value].push("0");
		}
	}
	localStorage["dictionary"] = JSON.stringify(dictionaryData);
    if(decreseHidvalue>=1){
		$('#quizword').html('WHAT IS THE MEANING OF '+dictionaryData[decreseHidvalue][0]);
		if(dictionaryData[decreseHidvalue][10]==dictionaryData[decreseHidvalue][6]){
			 quizdata1 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][6]+'" value="'+dictionaryData[decreseHidvalue][6]+'" checked="checked" />';
			 quizDefinition1=dictionaryData[decreseHidvalue][1];
		}else{
			quizdata1 ='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][6]+'" value="'+dictionaryData[decreseHidvalue][6]+'" onclick="selectFunction('+dictionaryData[decreseHidvalue][6]+')" />';
			quizDefinition1=dictionaryData[decreseHidvalue][1];
		}
		if(dictionaryData[decreseHidvalue][10]==dictionaryData[decreseHidvalue][7]){
			 quizdata2='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][7]+'" value="'+dictionaryData[decreseHidvalue][7]+'" checked="checked" />';
			 quizDefinition2=dictionaryData[decreseHidvalue][2];
		}else{
			quizdata2='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][7]+'" value="'+dictionaryData[decreseHidvalue][7]+'" onclick="selectFunction('+dictionaryData[decreseHidvalue][7]+')" />';
			quizDefinition2=dictionaryData[decreseHidvalue][2];
		}
		if(dictionaryData[decreseHidvalue][10]==dictionaryData[decreseHidvalue][8]){
			 quizdata3='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][8]+'" value="'+dictionaryData[decreseHidvalue][8]+'" checked="checked" />';
			 quizDefinition3=dictionaryData[decreseHidvalue][3];
		}else{
			quizdata3='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][8]+'" value="'+dictionaryData[decreseHidvalue][8]+'" onclick="selectFunction('+dictionaryData[decreseHidvalue][8]+')" />';
			quizDefinition3=dictionaryData[decreseHidvalue][3];
		}
		if(dictionaryData[decreseHidvalue][10]==dictionaryData[decreseHidvalue][9]){
			 quizdata4='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][9]+'" value="'+dictionaryData[decreseHidvalue][9]+'" checked="checked" />';
			 quizDefinition4=dictionaryData[decreseHidvalue][4];
		}else{
			quizdata4='<input type="radio" name="option'+decRadio_option+'" id="option1'+dictionaryData[decreseHidvalue][9]+'" value="'+dictionaryData[decreseHidvalue][9]+'" onclick="selectFunction('+dictionaryData[decreseHidvalue][9]+')" />';
			quizDefinition4=dictionaryData[decreseHidvalue][4];
		}
	}
	if(decreseHidvalue==1){
		next ='<a href="javascript:void(0)" onclick="nextQuestion()" ><h3>Next</h3></a>';
		$('#next').html(next);
		$('#previous').hide();
		
	}else{
		next ='<a href="javascript:void(0)" onclick="nextQuestion()" ><h3>Next</h3></a>';
		previous ='<a href="javascript:void(0)" onclick="previousQuestion()" ><h3>Previous</h3></a>';
		$('#next').html(next);
		$('#previous').html(previous);
	}  
	$('#quizdata1').html(quizdata1);
	$('#quizDefinition1').html(quizDefinition1);
	$('#quizdata2').html(quizdata2);
	$('#quizDefinition2').html(quizDefinition2);
	$('#quizdata3').html(quizdata3);
	$('#quizDefinition3').html(quizDefinition3);
	$('#quizdata4').html(quizdata4);
	$('#quizDefinition4').html(quizDefinition4);
	$('#hid_value').val(parseInt($('#hid_value').val())-1);
	$('#pre_hid_value').val(parseInt(decreseHidvalue));
	$('#radio_option').val(decRadio_option);
}
function selectFunction(optionValue){
	sno=optionValue;
}
function submitQuestion(){
	var dictionaryData= JSON.parse(localStorage["dictionary"]);
	var hid_value=parseInt($('#hid_value').val())-1;
	var checked_site_radio = $('input:radio[id=option1'+sno+']:checked').val();
	if(typeof checked_site_radio=="undefined"){
		if(typeof dictionaryData[hid_value][10]!="undefined"){
			if(dictionaryData[hid_value][10]==dictionaryData[hid_value][6]){
				var checked_site_radio=dictionaryData[hid_value][6];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][7]){
				var checked_site_radio=dictionaryData[hid_value][7];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][8]){
				var checked_site_radio=dictionaryData[hid_value][8];
			}else if(dictionaryData[hid_value][10]==dictionaryData[hid_value][9]){
				var checked_site_radio=dictionaryData[hid_value][9];
			}
		}
	}
	if(typeof dictionaryData[hid_value][10]!="undefined"){
		if(typeof dictionaryData[hid_value][11]!="undefined"){
			dictionaryData[hid_value].splice(11,1);
		}
		dictionaryData[hid_value].splice(10,1);
		dictionaryData[hid_value].push(checked_site_radio);
	}else{
		dictionaryData[hid_value].push(checked_site_radio);
	}
	if(typeof dictionaryData[hid_value][10]!="undefined"){
		if(dictionaryData[hid_value][5]==dictionaryData[hid_value][10]){
			dictionaryData[hid_value].push("1");
		}else{
			dictionaryData[hid_value].push("0");
		}
	}
	localStorage["dictionary"] = JSON.stringify(dictionaryData);
	//alert(dictionaryData[hid_value][1]);return false;
	var wrong_answers=0;
	var correct_answers=0;
	var notattempts=0;
	
	for(var i=1; i<=5; i++){
		if(dictionaryData[i][11]==1){
			correct_answers++;
		}
		if(dictionaryData[i][11]==0){
			wrong_answers++;
		}
		if(dictionaryData[i][10]==null){
			notattempts++;
		}
	}
	//newly added code
	var id=1;
	$.ajax({
		type: "GET",
		url: webServiceUrl+'get-user-quizs/'+id,
		success: function(data){
			if(data.value==1){
				var splitquizeName='';
				var obj = eval("(" + data.quizeDetails + ")");
				$.each(obj, function (index,Object) {
						var quizeName1=Object.quiz_name;
						 splitquizeName=quizeName1.split('-');
						
				});
				var h=parseInt(splitquizeName[1])+1;
				var quizeName='quize-'+h;
				$.ajax({
					type: "POST",
					url: webServiceUrl+'insert-user-quiz-name',
					data: {userId:'1',quizeName:quizeName,dictionaryData:dictionaryData},
					success: function(data){
						if(data.value==1){//window.location="quizinformation.html?id="+correct_answers+'-'+wrong_answers+'-'+notattempts;
							window.location="quizinformation.html?id="+data.id;
						}
					}
				});
	
	
			}else{
				var quizeName='quize-1';
				$.ajax({
					type: "POST",
					url: webServiceUrl+'insert-user-quiz-name',
					data: {userId:'1',quizeName:quizeName,dictionaryData:dictionaryData},
					success: function(data){
						if(data.value==1){//window.location="quizinformation.html?id="+correct_answers+'-'+wrong_answers+'-'+notattempts;
							window.location="quizinformation.html?id="+data.id;
						}
					}
				});
	
			}
		}
	});
	
	//End
	
}
function quizInformationFunction(){
	localStorage.clear();
	var id=getParameterByName('id');
	$.ajax({
		type: "GET",
		url: webServiceUrl+'insert-user-quiz-name/'+id,
		success: function(data){
			html="";
			if(data.value==1){
				html+='<a href="quizindex.html">Home</a>';
				html+='<div class="score_title">';
					html+='<h1>Your Results</h1>';
				html+='</div>';
				var j=0;k=0;l=0;
				var obj = eval("(" + data.quizeDetails + ")");
				$.each(obj, function (index,Object) {
					if(Object.checked_answer_id==0 || Object.checked_answer_id==null ){
								l++;
					}
					var options=Object.question_options;
				    html+='<div class="questions"><div class="span1">';
				    html+='<h3 id="incvalue" >'+(j+1)+'</h3></div><div class="span2">';
				    html+='<h3>WHAT IS THE MEANING OF '+Object.question+'</h3></div>';
				    html+='<div class="clearfix"></div>';
				    html+='</div>';
					var splitoptions=options.split('***');
					var subSplitOptions=splitoptions[0].split('**');
					html+='<div class="choicediv">';
					for(var i=0;i<4;i++){
						var splitoptions=options.split('***');
						var subSplitOptions=splitoptions[i].split('**');
						if(subSplitOptions[1]==Object.correct_answer_id){
							j++;
							var correctAns='Correct';
						}
						if(subSplitOptions[1]==Object.checked_answer_id){
							if(Object.correct_answer_id==Object.checked_answer_id){
								var checkedAns='';
							}else{
								k++;
								var checkedAns='Wrong';
							}
							
						}
						html+='<div class="choice_optins">';
							html+='<div class="span1"><h3 id="quizdata1">'+(i+1)+'</h3></div>';
							html+='<div class="span2">';
								html+='<h3 id="quizDefinition1">'+subSplitOptions[0];
							if(subSplitOptions[1]==Object.correct_answer_id){
								var correctAns='Correct';
								html+='<span style="color:red;">'+correctAns+'</span>';
							}
							if(subSplitOptions[1]==Object.checked_answer_id){
								if(Object.correct_answer_id!=Object.checked_answer_id){
									var checkedAns='Wrong';
									html+='<span style="color:red;">'+checkedAns+'</span>';
								}
							}
							html+='</h3></div>';
							html+='<div class="clearfix"></div>';
						html+='</div>';
				
					}
				html+='</div>';
				});
				var h=(5-k-l);
				html+='<div>Correct Answer: '+h+'</br>';
				html+='Wrong Answer: '+k+'</br>';
				html+='NotAttempt :'+l;
				html+='</div>';
				$('#well').html(html);
			}else{
				$('#well').html('No Records <br/><a href="quizindex.html">Back</a>');
			}
		}
	});
	
	//$('#correctAnswer').html('Correct Answer: '+splitquizinfo[0]);
	//$('#wrongAnswer').html('Wrong Answer: '+splitquizinfo[1]);
	//$('#notAttempt').html('NotAttempt :'+splitquizinfo[2]);
}
function getQuizResultsInformation(){
	var id='1';
	$.ajax({
		type: "GET",
		url: webServiceUrl+'get-user-quizs/'+id,
		success: function(data){
			html="";
			if(data.value==1){
				var obj = eval("(" + data.quizeDetails + ")");
					html+='<div class="score_title">';
					html+='<h1>Your Quize Details</h1>';
					html+='</div>';
				$.each(obj, function (index,Object) {
						html+='<div class="home_buttons_start">';
					html+='<a href="quizinformation.html?id='+Object.id+'"><div class="home_btn">';
						html+='<h3>'+Object.quiz_name+'</h3> on '+Object.added_date+'';
					html+='</div></a>';
				html+='</div>';
				});
				$('#well').html(html);
			}else{
				$('#well').html('No Records <br/><a href="quizindex.html">Back</a>');
			}
		}
	});
	
	//$('#correctAnswer').html('Correct Answer: '+splitquizinfo[0]);
	//$('#wrongAnswer').html('Wrong Answer: '+splitquizinfo[1]);
	//$('#notAttempt').html('NotAttempt :'+splitquizinfo[2]);
}
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
} 
